Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

d3-scale

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-scale

Encodings that map abstract data to visual representation.

  • 1.0.7
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is d3-scale?

The d3-scale package is part of the D3 (Data-Driven Documents) library that provides a powerful toolset for visualizing and mapping data. It offers a variety of scales for positioning and interpolating data, including linear, power, logarithmic, time, and ordinal scales. These scales can be used to transform data for visual representation in charts, graphs, and other data-driven visualizations.

What are d3-scale's main functionalities?

Linear Scale

A linear scale maps a continuous input domain to a continuous output range. It is commonly used for quantitative data.

{"const scale = d3.scaleLinear().domain([0, 100]).range([0, 1]); const result = scale(50);"}

Ordinal Scale

An ordinal scale maps a set of named categories to a discrete range. It is useful for categorical data.

{"const scale = d3.scaleOrdinal().domain(['A', 'B', 'C']).range([0, 1, 2]); const result = scale('B');"}

Time Scale

A time scale is similar to a linear scale but is specifically for time-based data. It maps a continuous time domain to a continuous range.

{"const scale = d3.scaleTime().domain([new Date(2020, 0, 1), new Date(2020, 11, 31)]).range([0, 100]); const result = scale(new Date(2020, 5, 15));"}

Logarithmic Scale

A logarithmic scale is used for data that spans multiple orders of magnitude. It maps a continuous domain to a continuous range using a logarithmic transformation.

{"const scale = d3.scaleLog().domain([1, 100]).range([0, 1]); const result = scale(10);"}

Quantize Scale

A quantize scale maps a continuous domain to a discrete range. It divides the domain into uniform segments based on the number of values in the range.

{"const scale = d3.scaleQuantize().domain([0, 100]).range(['low', 'medium', 'high']); const result = scale(55);"}

Other packages similar to d3-scale

Keywords

FAQs

Package last updated on 21 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc